1. Technical Field
The present disclosure relates generally to the instrumentation of software code for software application performance and transaction monitoring.
2. Background
Instrumentation of software application code is a process of inserting additional instructions into the code stream to enable measurement of one or more properties of the code while executing in an environment. These additional instructions do not change the intended behavior of the software application code. Instead, the additional instructions can either make calls to an agent that records the callout time and other data points, or record the information directly in-line with the original code. Instrumentation of software application code, referred to herein as target code, may occur by wrapper methods or by in-line instrumentation.
The wrapper methods, generally, replace the original code with a shell that performs recording and calls the original code. Wrapper methods generate an extra call level in the call tree hierarchy, have difficulties interacting with the runtime environment (e.g., .NET or Java Virtual Machine) due to complexity, and may create a security threat to the operating environment because of the changes the wrapper methods make to the call stack.
In-line instrumentation addresses several of these issues; in-line instrumentation inserts a prolog (which includes code to record a program state at the start of the target code) before the target code and an epilog (which includes code to record a program state at the completion of the target code) after the target code. Although in-line instrumentation is not subject to the same challenges as wrapper methods, in-line instrumentation is also beset with difficulties. Additional instructions must be inserted into key places in the target code, which requires analysis and alteration of both the inserted code and the target code in order to address any possible changes in branch target offsets and to guarantee execution of the inserted epilog code. The analysis and alteration may require multiple passes through the code, where branch target offsets may have to be recomputed several times.
The present disclosure will be described with reference to the accompanying drawings. Generally, the drawing in which an element first appears is typically indicated by the leftmost digit(s) in the corresponding reference number.